﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using LGE;

namespace YouOnlyGetOne
{
    public class Key : GameObject
    {
        public static Texture2D Texture;
        SpriteSheet ss;

        public Key(PlayScreen ps, Vector2 pos)
            : base(ps, Texture)
        {
            this.position = pos;
            ss = new SpriteSheet(this, 64, 64, 100, true);

            sourceRectangle = HitBox = new Rectangle(0, 0, 64, 64);
            origin = new Vector2(sourceRectangle.Width / 2, sourceRectangle.Height / 2);
        }

        public override void Update(GameTime gameTime)
        {
            ss.Update(gameTime);
            if (Collision(ps.player))
            {
                Audio.PlayCue("key_pick");
                ps.player.keys++;
                alive = false;
            }
        }
    }
}
